range(start ,stop ,step) range(start ,stop) range(stop)
for i in range(1,11): print(i,end=' ')
1 2 3 4 5 6 7 8 9 10
for i in range(10,0,-1): print(i,end=' ')
10 9 8 7 6 5 4 3 2 1
for i in range(1,101,2): print(i,end=' ')
for i in range(2,101,2): print(i,end=' ')
n=int(input("Enter a Number")) for i in range(1,n+1): print(i,end=' ')
Enter a Number 7 1 2 3 4 5 6 7
n=int(input("Enter a Number")) for i in range(n, 0, -1): print(i, end=' ')
Enter a Number 7 7 6 5 4 3 2 1
n=int(input("Enter a Number")) s=0 for i in range(1,n+1): s=s+i print("Sum is ",s)
Enter a Number 5 Sum is 15
n=int(input("Enter a Number")) f=1 for i in range(1,n+1): f=f*i print("Factorial is ",f)
Enter a Number 5 Factorial is 120
city="Amravati" for ch in city: print(ch)
A m r a v a t i
city="Amravati" c=0 for ch in city: if ch=="a" or ch=="A": c=c+1 print("Total a are ",c)
Total a are 3